package router

import (
	jwt "gitee.com/sansaniot/ssiot-core/httpmvc/jwtauth"
	"github.com/gin-gonic/gin"
	"ssadmin/internal/admin/apis"
)

func init() {
	AuthRouters = append(AuthRouters, registerMenuRouter)
}

// registerMenuRouter
func registerMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.Menu{}
	r := v1.Group("/api/menu").Use(authMiddleware.MiddlewareFunc())
	{
		// 查找菜单或按钮
		r.GET("/find", api.GetList)
		// 修改菜单顺序
		r.POST("/order/modify", api.EditOrder)
		// 添加菜单或按钮
		r.POST("/add", api.Insert)
		// 修改菜单或按钮
		r.POST("/modify", api.Update)
		// 删除菜单或按钮
		r.POST("/remove", api.Delete)
	}
}
